//
//  XQIdentityAccureCell.swift
//  Spark Peso
//
//  Created by 小琦 on 2025/2/6.
//

import UIKit

class XQIdentityAccureCell: UITableViewCell {

    private lazy var bgView : UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(hex: "#F6F6F6")
        view.layer.cornerRadius = 12
        return view
    }()
    
    private lazy var contentLb : UILabel = {
        let lb = UILabel()
        lb.textColor = .xq_black
        lb.font = UIFont.systemFont(ofSize: 16, weight: .medium)
        return lb
    }()
    
    private lazy var arrowImageView : UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "public_accure_arrow")
        return imageView
    }()
    
    var content : String = "" {
        didSet {
            self.contentLb.text = content
        }
    }
    
    var selectArrow : Bool = false {
        didSet {
            self.arrowImageView.isHidden = !selectArrow
        }
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
       super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        makeUI()
        makeConstraints()
    }

    required init?(coder: NSCoder) {
       fatalError("init(coder:) has not been implemented")
    }
    
    private func makeUI() {
        self.contentView.addSubview(self.bgView)
        self.bgView.addSubview(self.contentLb)
        self.bgView.addSubview(self.arrowImageView)
    }
    
    private func makeConstraints() {
        self.bgView.snp.makeConstraints { make in
            make.top.equalTo(0)
            make.left.equalTo(17)
            make.right.equalTo(-17)
            make.bottom.equalTo(-18)
        }
        self.contentLb.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(16)
        }
        self.arrowImageView.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.right.equalTo(-16)
        }
    }

}
